﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Zhao.Common.Helper;
using Zhao.Models.DTO;
using Zhao.Models.Entity;

namespace Zhao.IServer.Management_Arena
{
    /// <summary>
    /// 球馆申请表（入驻审核流程）
    ///</summary>
    public interface IVenueApplicationsServer : IBaseService<VenueApplications>
    {
        /// <summary>
        /// 获取球馆申请入驻审核信息
        /// </summary>
        /// <param name="expressionable"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Task<PageModel<VenueApplicationDTO>> VenueApplicationsQuery(Expression<Func<VenueApplications, Admin, Users, Area, Area, Area, bool>> expressionable, int pageIndex, int pageSize);
        /// <summary>
        /// 球馆入驻审核
        /// </summary>
        /// <param name="applications"></param>
        /// <param name="adminId"></param>
        /// <returns></returns>
        public Task<ApiResult> ProcessReviewAsync(VenueApplications applications, int adminId);


        #region 小程序api
        /// <summary>
        /// 小程序端添加球馆申请
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Task<ApiResult> AddVenueApplicationAsync(VenueApplications application);
        /// <summary>
        /// 查询用户是否已提交过球馆入驻申请
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>申请状态和数据</returns>
        public Task<ApiResult<VenueApplicationDTO>> CheckUserApplicationAsync(int userId);
        
        /// <summary>
        /// 查询用户申请状态
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>申请状态，如果没有申请则返回0</returns>
        public Task<ApiResult<short>> GetUserApplicationStatusAsync(int userId);

        /// <summary>
        /// 重新提交球馆入驻申请
        /// </summary>
        /// <param name="applicationId">申请ID</param>
        /// <param name="application">更新后的申请信息</param>
        /// <returns>操作结果</returns>
        public Task<ApiResult> ReapplyVenueApplicationAsync(int applicationId, VenueApplications application);
        
        /// <summary>
        /// 更新申请状态为已完成
        /// </summary>
        /// <param name="venueId">球馆ID</param>
        /// <returns>操作结果</returns>
        public Task<ApiResult> UpdateApplicationStatusToCompletedAsync(Guid venueId);
        #endregion

    }
}
